<?php
class Soul_Validation_Rule_RangeLength extends Soul_Validation_Rule_Base {

	private $_max = NULL;
	private $_min = NULL;
	
    public function  __construct($min = NULL, $max = NULL){
        parent::__construct();
        $this->_max = $max;
        $this->_min = $min;
    }
    
    public function getMax($value){
    	return $this->_max;
    }    
    public function setMax($value){
    	$this->_max = $value;
    }
    
    public function getMin(){
    	return $this->_min;
    }
    public function setMin($value){
    	$this->_min = $value;
    }

    public function getType(){
        return 'rangeLength';
    }

    public function check($value) {
        return strlen($value) <= $this->getMax() && strlen($value) >= $this->getMin();
    }
}